package com.iplant.mes.service.po.sfc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.general.CalendarTool;
import com.iplant.pdm.service.basicenum.pdm.PDMComponentTypes;

import java.util.Calendar;

/**
 * 工件记录
 *
 * @author YouWang·Peng
 * 2023-8-29 10:25:49
 */
@DBBasePO(TableName = "sfc_workpiece_record", Name = false, Active = false, Schemas = DBSchemas.MES,
        CheckName = {"Code"})
public class SFCWorkpieceRecord extends BasePO {
    /**
     * 订单ID
     */
    @DBCondition
    @DBField
    public int OrderID = 0;
    /**
     * 订单号
     */
    @DBCondition
    @DBField
    public String OrderNo = "";

    @DBCondition
    @DBField
    public int ProductID = 0;

    @DBJoin(name = "Code", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductNo = "";

    @DBJoin(name = "Name", tableName = "fpc_product", tableAsName = "fpc_product1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public String ProductName = "";

    /**
     * 上线时间
     */
    @DBField
    public Calendar OnLineTime = Calendar.getInstance();
    /**
     * 上线工位ID
     */
    @DBField
    public int OnLineStationID = 0;
    /**
     * 上线工位名称
     */
    @DBJoin(name = "Name", tableName = "fmc_station", tableAsName = "fmc_station1", Schemas = DBSchemas.Basic,
            MainTableField = "OnLineStationID")
    public String OnLineStationName = "";

    /**
     * 下线时间
     */
    @DBField
    public Calendar OffLineTime = Calendar.getInstance();
    /**
     * 下线工位ID
     */
    @DBField
    public int OffLineStationID = 0;
    /**
     * 下线工位名称
     */
    @DBJoin(name = "Name", tableName = "fmc_station", tableAsName = "fmc_station2", Schemas = DBSchemas.Basic,
            MainTableField = "OffLineStationID")
    public String OffLineStationName = "";
    /**
     * 工件状态
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.in)
    @DBField
    public int Status = 0;

    /**
     * 产出类型
     */
    @DBCondition
    @DBField
    public int ComponentType = 0;

    /**
     * 产出类型
     */
    public String ComponentTypeText = "";

    /**
     * 成品码
     */
    @DBCondition
    @DBField
    public String PackageNo = "";
    /**
     * 外壳码（芯子码）
     */
    @DBCondition
    @DBField
    public String CaseNo = "";
    /**
     * 箱码
     */
    @DBCondition
    @DBField
    public String BoxNo = "";

    /**
     * 工装码
     */
    @DBCondition
    @DBField
    public String FrockNo = "";

    /**
     * 报废人ID
     */
    @DBField
    public int ScarpID = 0;
    /**
     * 报废人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user1", Schemas = DBSchemas.Basic,
            MainTableField = "ScarpID")
    public String ScarpName = "";
    /**
     * 报废时刻
     */
    @DBField
    public Calendar ScarpTime = CalendarTool.getBasicDate();
    /**
     * 报废原因
     */
    @DBField
    public String ScarpReason = "";

    /**
     * 出厂产品条码（扫芯子，得产品码，与出厂码绑定）
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String FPBarcode = "";

    /**
     * 检验结果
     */
    @DBCondition
    @DBField
    public int CheckResult = 0;

    /**
     * 返工标记
     */
    @DBCondition
    @DBField
    public int ReworkFlag = 0;

    /**
     * 首检标记
     */
    @DBField
    @DBCondition
    public int FirstFlag = 0;

    @JsonProperty("OrderID")
    public int getOrderID() {
        return OrderID;
    }

    public void setOrderID(int orderID) {
        OrderID = orderID;
    }

    @JsonProperty("OrderNo")
    public String getOrderNo() {
        return OrderNo;
    }

    public void setOrderNo(String orderNo) {
        OrderNo = orderNo;
    }

    @JsonProperty("OnLineTime")
    public Calendar getOnLineTime() {
        return OnLineTime;
    }

    public void setOnLineTime(Calendar onLineTime) {
        OnLineTime = onLineTime;
    }

    @JsonProperty("OnLineStationID")
    public int getOnLineStationID() {
        return OnLineStationID;
    }

    public void setOnLineStationID(int onLineStationID) {
        OnLineStationID = onLineStationID;
    }

    @JsonProperty("OnLineStationName")
    public String getOnLineStationName() {
        return OnLineStationName;
    }

    public void setOnLineStationName(String onLineStationName) {
        OnLineStationName = onLineStationName;
    }

    @JsonProperty("OffLineTime")
    public Calendar getOffLineTime() {
        return OffLineTime;
    }

    public void setOffLineTime(Calendar offLineTime) {
        OffLineTime = offLineTime;
    }

    @JsonProperty("OffLineStationID")
    public int getOffLineStationID() {
        return OffLineStationID;
    }

    public void setOffLineStationID(int offLineStationID) {
        OffLineStationID = offLineStationID;
    }

    @JsonProperty("OffLineStationName")
    public String getOffLineStationName() {
        return OffLineStationName;
    }

    public void setOffLineStationName(String offLineStationName) {
        OffLineStationName = offLineStationName;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    @JsonProperty("ComponentType")
    public int getComponentType() {
        return ComponentType;
    }

    public void setComponentType(int componentType) {
        ComponentType = componentType;
    }

    @JsonProperty("PackageNo")
    public String getPackageNo() {
        return PackageNo;
    }

    public void setPackageNo(String packageNo) {
        PackageNo = packageNo;
    }

    @JsonProperty("CaseNo")
    public String getCaseNo() {
        return CaseNo;
    }

    public void setCaseNo(String caseNo) {
        CaseNo = caseNo;
    }

    @JsonProperty("BoxNo")
    public String getBoxNo() {
        return BoxNo;
    }

    public void setBoxNo(String boxNo) {
        BoxNo = boxNo;
    }

    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductNo")
    public String getProductNo() {
        return ProductNo;
    }

    public void setProductNo(String productNo) {
        ProductNo = productNo;
    }

    @JsonProperty("ProductName")
    public String getProductName() {
        return ProductName;
    }

    public void setProductName(String productName) {
        ProductName = productName;
    }

    @JsonProperty("FrockNo")
    public String getFrockNo() {
        return FrockNo;
    }

    public void setFrockNo(String frockNo) {
        FrockNo = frockNo;
    }

    @JsonProperty("ScarpID")
    public int getScarpID() {
        return ScarpID;
    }

    public void setScarpID(int scarpID) {
        ScarpID = scarpID;
    }

    @JsonProperty("ScarpName")
    public String getScarpName() {
        return ScarpName;
    }

    public void setScarpName(String scarpName) {
        ScarpName = scarpName;
    }

    @JsonProperty("ScarpTime")
    public Calendar getScarpTime() {
        return ScarpTime;
    }

    public void setScarpTime(Calendar scarpTime) {
        ScarpTime = scarpTime;
    }

    @JsonProperty("ScarpReason")
    public String getScarpReason() {
        return ScarpReason;
    }

    public void setScarpReason(String scarpReason) {
        ScarpReason = scarpReason;
    }

    @JsonProperty("FPBarcode")
    public String getFPBarcode() {
        return FPBarcode;
    }

    public void setFPBarcode(String FPBarcode) {
        this.FPBarcode = FPBarcode;
    }

    @JsonProperty("CheckResult")
    public int getCheckResult() {
        return CheckResult;
    }

    public void setCheckResult(int checkResult) {
        CheckResult = checkResult;
    }

    @JsonProperty("ComponentTypeText")
    public String getComponentTypeText() {
        ComponentTypeText = PDMComponentTypes.getEnumType(ComponentType).getLabel();
        return ComponentTypeText;
    }

    public void setComponentTypeText(String componentTypeText) {
        ComponentTypeText = componentTypeText;
    }

    @JsonProperty("ReworkFlag")
    public int getReworkFlag() {
        return ReworkFlag;
    }

    public void setReworkFlag(int reworkFlag) {
        ReworkFlag = reworkFlag;
    }

    @JsonProperty("FirstFlag")
    public int getFirstFlag() {
        return FirstFlag;
    }

    public void setFirstFlag(int firstFlag) {
        FirstFlag = firstFlag;
    }
}
